package br.upe.dsc.pcsbj.cdoc.core;
import java_cup.runtime.Symbol;

%%

%class Cdoc
%unicode
%cup
%line
%column

whitespace = [ \t\n\r\f]
letters = [a-zA-Z_]
numbers = [0-9]
word = {letters}+
integer = {numbers}+
comma = ","
lchave = "{"
rchave = "}"
real = {integer}"."{integer}
nporp = "P" | "NP"
begin = "/*@"
end = "@*/"

/* cdoc */
function = "@function"

/* cml */
task = "@task"
processor = "@processor"
scheduling = "@scheduling"
phase = "@phase"
release = "@release"
wcet = "@wcet"
deadline = "@deadline"
period = "@period"
precedes = "@precedes"
excludes = "@excludes"
sends = "@sends"
usedmemory = "@usedmemory"
codesize = "@codesize"
cachehit = "@cachehit"
cachemiss = "@cachemiss"
pagefault = "@pagefault"
power = "@power"
pesaccess = "@pesaccess"
optaccess = "@optaccess"

/* javadoc */
author = "@author"
code = "@code"
docroot = "@docroot"
deprecated = "@deprecated"
link = "@link"
param = "@param"
return = "@return"
see = "@see"
since = "@since"
version = "@version"

%%

/* CDoc */
{function}		{ return new Symbol(sym.ATFUNCTION); }

/* CML */
{task}			{ return new Symbol(sym.ATTASK); }
{processor}	{ return new Symbol(sym.ATPROCESSOR); }
{scheduling}	{ return new Symbol(sym.ATSCHEDULING); }
{phase}		{ return new Symbol(sym.ATPHASE); }
{release}		{ return new Symbol(sym.ATRELEASE); }
{wcet}			{ return new Symbol(sym.ATWCET); }
{deadline}	{ return new Symbol(sym.ATDEADLINE); }
{period}		{ return new Symbol(sym.ATPERIOD); }
{precedes}	{ return new Symbol(sym.ATPRECEDES); }
{excludes}		{ return new Symbol(sym.ATEXCLUDES); }
{sends}		{ return new Symbol(sym.ATSENDS); }
{usedmemory}	{ return new Symbol(sym.ATUSEDMEMORY); }
{codesize}	{ return new Symbol(sym.ATCODESIZE); }
{cachehit}	{ return new Symbol(sym.ATCACHEHIT); }
{cachemiss}	{ return new Symbol(sym.ATCACHEMISS); }
{pagefault}	{ return new Symbol(sym.ATPAGEFAULT); }
{power}		{ return new Symbol(sym.ATPOWER); }
{pesaccess}	{ return new Symbol(sym.ATPESACCESS); }
{optaccess}	{ return new Symbol(sym.ATOPTACCESS); }

/* JAVADOC */
{author}		{ return new Symbol(sym.ATAUTHOR); }
{code}			{ return new Symbol(sym.ATCODE); }
{docroot}		{ return new Symbol(sym.ATDOCROOT); }
{deprecated}	{ return new Symbol(sym.ATDEPRECATED); }
{link}			{ return new Symbol(sym.ATLINK); }
{processor}	{ return new Symbol(sym.ATPROCESSOR); }
{scheduling}	{ return new Symbol(sym.ATSCHEDULING); }
{phase}		{ return new Symbol(sym.ATPHASE); }
{param}			{ return new Symbol(sym.ATPARAM); }
{return}		{ return new Symbol(sym.ATRETURN); }
{see}			{ return new Symbol(sym.ATSEE); }
{since}			{ return new Symbol(sym.ATSINCE); }
{version}		{ return new Symbol(sym.ATVERSION); }

/* GENERAL */
{nporp}		{ return new Symbol(sym.NPORP); }
{begin} 	{ return new Symbol(sym.BEGIN); }
{end}		{ return new Symbol(sym.END); }
{integer}	{ return new Symbol(sym.INTEGER); }
{word} 		{ return new Symbol(sym.WORD); }
{real}		{ return new Symbol(sym.REAL); }
{lchave}	{ return new Symbol(sym.LCHAVE); }
{rchave}	{ return new Symbol(sym.RCHAVE); }
{comma}		{ return new Symbol(sym.COMMA); }
{whitespace} 	{ /* ignore */ }

.				{System.out.println("Error: unknown character " + yytext() + " found at line " + yyline);}
